/**
 * 
 */
package cyclopean.world;

import cyclopean.world.Actor.Position;
import javagame.core.main.Temporal;
import javagame.core.main.Time;

// TODO Javadoc
/**
 * 
 *
 * @author Jaco van der Westhuizen
 */
class World implements Temporal
{
	private static World instance = null;
	
	World()
	{
		if (instance == null)
			instance = this;
		else
			throw new IllegalStateException("There may be only one world at a time.");
	}
	
	// TODO Use generator and/or load from file
	Zone[] zones = new Zone[] {new Zone(0, 0)};

	/* (non-Javadoc)
	 * @see javagame.core.main.Temporal#update(javagame.core.main.Time)
	 */
	@Override
	public void update(Time time)
	{
		// TODO Auto-generated method stub

	}

	/**
     * @param x
     * @param y
     * @param z
     * @return
     */
    public static Position convertAbsolutePos(float x, float y, float z)
    {
    	if (instance == null)
    		throw new IllegalStateException("World does not exist.");

	    // TODO Handle multiple zones
    	Position out = new Position();
    	
    	out.zone = instance.zones[0];
    	out.x = x;
    	out.y = y;
    	out.z = z;
    	
	    return out;
    }

}
